package com.linwt.service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.linwt.bean.Visitor;
import com.linwt.mapper.VisitorMapper;

@Service
public class VisitorService {
	@Autowired
	VisitorMapper visitorMapper;
	public String addVisitor(String name,String gender,String phone,String timeStr) {
		Visitor visitor = new Visitor();
		visitor.setName(name);
		visitor.setGender(gender);
		visitor.setPhone(phone);
		String id = "1"+timeStr;
		visitor.setId(id);
		
		visitorMapper.addVisitor(visitor);
		return id;
	}
	
	public String findVisitorByNameAndPhone(String name, String phone) {
		return visitorMapper.findVisitorByNameAndPhone(name, phone);
	}
	
	public List<Visitor> listAllVisitors(){
		return visitorMapper.listAllVisitors();
	}
}
